import request from "@/utils/request";
import type { Admin, Category, CutpageParam, Goods, User } from "@/model";
export function uploadPictureURL() {
  return "/admin/upload/picture";
}

export function login(data: Admin) {
  return request.post("/admin/login", data);
}

export function getAdmin() {
  return request.get("/admin/admin");
}
export function getCategoryList() {
  return request.get("/admin/category/list");
}

export function addCategory(data: Category) {
  return request.post("/admin/category/add", data);
}

export function updateCategory(data: Category) {
  return request.post("/admin/category/save", data);
}

export function delCategory(data: Category) {
  return request.post("/admin/category/del", data);
}

export function getGoodsList(params: CutpageParam) {
  return request.get("/admin/goods/list", { params });
}

export function addGoods(data: Goods) {
  return request.post("/admin/goods/add", data);
}

export function updateGoods(data: Goods) {
  return request.post("/admin/goods/save", data);
}

export function delGoods(data: Goods) {
  return request.post("/admin/goods/del", data);
}

export function getUserList() {
  return request.get("/admin/user/list");
}

export function addUser(data: User) {
  return request.post("/admin/user/add", data);
}

export function changeState(data: User) {
  return request.post("/admin/user/changeState", data);
}

export function updateUser(data: User) {
  return request.post("/admin/user/save", data);
}

export function deleteUser(data: User) {
  return request.post("/admin/user/delete", data);
}

export function getAdminList() {
  return request.get("/admin/role/list");
}

export function addAdmin(data: Admin) {
  return request.post("/admin/add", data);
}

export function getPermissionList() {
  return request.get("/admin/user/permission");
}

export function updateAdmin(data: Admin) {
  return request.post("/admin/save", data);
}

export function deleteAdmin(data: Admin) {
  return request.post("/admin/delete", data);
}

export function changeAdminPassword(data: Admin) {
  return request.post("/admin/admin/changePassword", data);
}
export function changeAdminAvatar(data: Admin) {
  return request.post("/admin/admin/changeAvatar", data);
}
